package com.jsyl.lwbk.web.controller.education;

import com.jsyl.lwbk.business.dto.education.TrainingProgramChildRecordListDTO;
import com.jsyl.lwbk.business.dto.education.TrainingReportDTO;
import com.jsyl.lwbk.business.service.education.ITrainingProgramChildRecordService;
import com.jsyl.lwbk.common.core.controller.BaseController;
import com.jsyl.lwbk.common.core.domain.AjaxResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

/**
 * @author jh
 * @date 2021-04-02 16:27
 * @desc 训练报告
 **/
@Controller
@RequestMapping("/education/trainingReport")
public class TrainingReportController extends BaseController {

    private String prefix = "education/trainingReport";

    @Autowired
    private ITrainingProgramChildRecordService trainingProgramChildRecordService;

    @RequiresPermissions("education:trainingReport:view")
    @GetMapping()
    public String trainingReport(ModelMap mmap) {
        return prefix + "/trainingReportList";
    }

    @GetMapping("/checkReport/{childId}/{scheduleTime}")
    public String checkReport(@PathVariable("childId") Long childId,@PathVariable("scheduleTime") String scheduleTime, ModelMap mmap) {
        mmap.put("childId",childId);
        mmap.put("scheduleTime",scheduleTime);
        return prefix + "/trainingReport";
    }

     /**
     * 训练报告
     */
    @PostMapping("/findTrainingReport")
    @ResponseBody
    public AjaxResult findTrainingReport(TrainingProgramChildRecordListDTO trainingProgramChildRecordListDTO) {
        TrainingReportDTO trainingReportDTO = trainingProgramChildRecordService.findTrainingReport(trainingProgramChildRecordListDTO);
        return AjaxResult.success(trainingReportDTO);
    }



}
